package org.p2psimulator.factory.peerfactory;

import org.p2psimulator.entity.Peer;
import org.p2psimulator.entity.behavior.Behavior;
import org.p2psimulator.entity.protocol.Protocol;
import org.p2psimulator.factory.Factory;
import org.p2psimulator.factory.idfactory.IdFactory;
import org.p2psimulator.engine.Environment;

/**
 * Gerador de peers
 * @author amorim
 *
 */
public class PeerFactory extends Factory <Peer>{

	private Behavior behavior;

	private Protocol protocol;

	private IdFactory factory;

	public PeerFactory(Behavior behavior, Protocol protocol, IdFactory factory) {
		super();
		this.behavior = behavior;
		this.protocol = protocol;
		this.factory = factory;
	}


	@Override
	public Peer generate() {
		Peer p = new Peer(factory.generate(), protocol, behavior);
		return p;
	}

}
